package com.gensdai.leliang.remoteInterface;

import com.gensdai.leliang.common.bean.AddressBean;
import com.gensdai.leliang.common.bean.ApplyInfoBean;
import com.gensdai.leliang.common.bean.ApplyOrderInfoBean;
import com.gensdai.leliang.common.bean.ApplyResultDetailBean;
import com.gensdai.leliang.common.bean.BrandListBean;
import com.gensdai.leliang.common.bean.CategoryBean;
import com.gensdai.leliang.common.bean.CommentInfoBean;
import com.gensdai.leliang.common.bean.LogisticsInfoBean;
import com.gensdai.leliang.common.bean.OffLineStoreBean;
import com.gensdai.leliang.common.bean.OrderProperInfoBean;
import com.gensdai.leliang.common.bean.SearchBean;
import com.gensdai.leliang.common.bean.ShopCarBean;
import com.gensdai.leliang.common.bean.UpdateInfoBean;
import com.gensdai.leliang.common.bean.WechatBean;
import com.gensdai.leliang.entity.HomeBean;
import com.gensdai.leliang.entity.parseBean.BaseParse;
import com.gensdai.leliang.entity.parseBean.BaseParseList;
import com.gensdai.leliang.entity.parseBean.ParentBean;
import com.gensdai.leliang.entity.parseBean.ProductInfo;
import com.gensdai.leliang.entity.parseBean.RegisterParse;

import java.util.Map;
import java.util.Objects;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PartMap;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;

/**
 * 本接口只添加与后台交互的接口code
 * Created by liutao on 2017/5/23.
 */

public interface InterfaceCodeUtils {

    //请求的域名  http://192.168.1.100:8080/lelongV1//lelongApp/register.html

    //        public static final String BASE_URL = "http://192.168.1.100:8080/lelongV1/lelongApp/";
//    public static final String BASE_URL = "http://192.168.1.9:8080/kvgou/lelongApp/";

//    public static final String BASE_URL = "http://testlelong.lelong1788.com:8000/lelongApp/";

    //正式
    //    public static final String BASE_URL = "https://www.lelong1788.com/lelongApp/";
//    public static final String TUPIAN = "https://www.lelong1788.com/";

    /**
     * 方法注解 : 包含@GET、@POST、@PUT、@DELETE、@PATCH、@HEAD、@OPTIONS、@HTTP。
     * 这个不多讲.一般用的就是@GET、@POST,很明显,一个是get请求,一个是post请求
     * <p>
     * 标记注解 : 包含@FormUrlEncoded、@Multipart、@Streaming。
     * 这个得和参数注解一起说
     * <p>
     * 参数注解 : 包含@Query,@QueryMap、@Body、@Field，@FieldMap、@Part，@PartMap。
     *
     * @Get---------用的参数注解就@Query,@QueryMap,
     * @Post--------则会用到 @Body、@Field，@FieldMap、@Part，@PartMap。
     * @Body-------将数据转化成Json,然后post.具体转化根据设置的解析工厂(下面有讲) ---------------------------------------------------分割线----------------------------------------------------------
     * @Field，@FieldMap------post上传表单.@Field表示单个,@FieldMap表示集合. 需要添加上面的@FormUrlEncoded表示表单提交 ,
     * 对应Content-Type:application/x-www-form-urlencoded
     * 如:
     * @FormUrlEncoded
     * @POST("login的url") Observable<User> login(@Field("name") String name, @FieldMap Map params);
     * --------------------------------------------------分割线------------------------------------------------------------
     * @Part，@PartMap----post上传文件/数据.@Part表示单个,@PartMap表示集合. 其中@Part MultipartBody.Part 类型代表文件，@Part(“key”) RequestBody类型代表参数
     * 需要添加@Multipart表示支持文件上传的表单，Content-Type: multipart/form-data
     * @Multipart
     * @POST("update的url") Observable<User> update(@Part ("file") MultipartBody.Part file, @Part(“key”) RequestBody key,
     * @PartMap Map<String,RequestBody> files);
     * 如果参数较少,使用@Part ("file")就可以解决了,如果参数较多,那就需要使用@PartMap了.
     * <p>
     * 如不清楚  请前往http://square.github.io/retrofit/    详细了解
     */


                            /*简单的查询*/
//    @GET("AppInterface/StyleInterface?code=11000")
//    public Observable<String> LoginRequest(@QueryMap Map<String, String> params);

                            /*post表单*/
//    @POST("getUser")
//    @FormUrlEncoded
//    Observable<BaseEntity<User>> getUser(@FieldMap Map<String, String> map);
    /*end*/
    @POST(URLConfig.REGISTER_URL)
    public Observable<RegisterParse> RegisterRequest(@QueryMap Map<String, String> params);

    //返回Str类型结果
    @POST(URLConfig.REGISTER_URL)
    public Observable<String> RegisterRequest2Str(@QueryMap Map<String, String> params);

    //返回Str类型结果 登录
    @POST(URLConfig.CHECK_LOGIN_URL)
    public Observable<String> LoginRequest2Str(@QueryMap Map<String, String> params);

    //返回Str类型结果 查看用户资金
    @POST(URLConfig.QUERY_ACCOUNT_URL)
    @FormUrlEncoded
    public Observable<String> QueryAccountRequest2Str(@FieldMap Map<String, String> params);

    //返回Str类型结果 获取支付信息
    @POST(URLConfig.BEGIN_ALIPAY_CONG_URL)
    public Observable<String> PayRequestStr(@QueryMap Map<String, String> params);

    //返回Str类型结果 新增收货地址
    @FormUrlEncoded
    @POST(URLConfig.ADD_ADDRESS_URL)
    public Observable<String> AddressRequestStr(@FieldMap Map<String, String> params);

    //返回Str类型结果 修改密码
    @FormUrlEncoded
    @POST(URLConfig.SET_MM_ACCOUNT_URL)
    public Observable<String> SETMMRequestStr(@FieldMap Map<String, String> params);

    //返回Str类型结果 修改密码
    @FormUrlEncoded
    @POST(URLConfig.CHANGE_PAY_PASSWORD)
    public Observable<String> CHANGE_PAY_PASSWORD(@FieldMap Map<String, String> params);

    //返回Str类型结果忘记支付密码
    @FormUrlEncoded
    @POST(URLConfig.FORGET_PAY_PASSWORD)
    public Observable<String> PAY_PASSWORDRequestStr(@FieldMap Map<String, String> params);


    //返回Str类型结果 自动更新
    @FormUrlEncoded
    @POST(URLConfig.APP_UPDATE_URL)
    public Observable<String> UpdateRequestStr(@FieldMap Map<String, String> params);

    @FormUrlEncoded
    @POST(URLConfig.APP_UPDATE_URL)
    public Observable<BaseParse<UpdateInfoBean>> UpdateRequestParse(@FieldMap Map<String, String> params);

    //返回Str类型结果 新增收货地址
    @FormUrlEncoded
    @POST(URLConfig.ADD_ADDRESS_URL)
    public Observable<String> AddressRequestStr(@Field("username") String name,
                                                @Field("userId") String userId,
                                                @Field("provinceId") String provinceId,
                                                @Field("cityId") String cityId,
                                                @Field("districtId") String districtId,
                                                @Field("detailedAddress") String detailedAddress,
                                                @Field("phone") String phone);

    //返回Str类型结果 编辑收货地址
    @FormUrlEncoded
    @POST(URLConfig.EDIT_ADDRESS_URL)
    public Observable<String> EditAddressRequestStr(@FieldMap Map<String, String> params);

    //返回Str类型结果 查询收货地址
    @POST(URLConfig.QUERY_ADDRESS_URL)
    public Observable<String> QueryRequestStr(@QueryMap Map<String, String> params);

    @POST(URLConfig.QUERY_ADDRESS_URL)
    public Observable<BaseParse<AddressBean>> QueryAddressList(@QueryMap Map<String, String> params);

    //成长贝获取获取记录
    @POST(URLConfig.FIND_GROW_ACCOUNT_URL)
    public Observable<String> FindGrow(@QueryMap Map<String, String> params);

    //获取图文验证码
    @GET(URLConfig.MAKE_VERIFY_CODE)
    @Streaming
    public Call<ResponseBody> MAKE_VERIFY_CODE(@QueryMap Map<String, String> params);

    //成长贝发放获取记录
    @POST(URLConfig.FIND_GROW_SHELL_ACCOUNT_URL)
    public Observable<String> FindGrowShell(@QueryMap Map<String, String> params);

    //成长贝使用获取记录
    @POST(URLConfig.Pay_Growth_ACCOUNT_URL)
    public Observable<String> PayGrowth(@QueryMap Map<String, String> params);

    //成长金记录
    @POST(URLConfig.FIND_GOLD_ACCOUNT_URL)
    public Observable<String> FindGold(@QueryMap Map<String, String> params);

    //查看第三方绑定状态
    @POST(URLConfig.QUERY_THIRDPARTY_STATE)
    public Observable<String> QUERY_THIRDPARTY_STATE(@QueryMap Map<String, String> params);

    //解除第三方绑定
    @POST(URLConfig.REMOVE_THIRDPARTY_BIND)
    public Observable<String> REMOVE_THIRDPARTY_BIND(@QueryMap Map<String, String> params);

    //绑定第三方绑定
    @POST(URLConfig.BIND_THIRDPARTY_DIRECTILY)
    public Observable<String> BIND_THIRDPARTY_DIRECTILY(@QueryMap Map<String, String> params);

    //设置个人中心孕育状态内容
    @FormUrlEncoded
    @POST(URLConfig.SET_PERSONAL_GESTATION)
    public Observable<String> SET_PERSONAL_GESTATION(@FieldMap Map<String, String> params);

    //查询个人中心孕育状态内容
    @POST(URLConfig.QUERY_PERSONAL_GESTATION)
    public Observable<String> QUERY_PERSONAL_GESTATION(@QueryMap Map<String, String> params);

    //返回Str类型结果 订单管理
    @POST(URLConfig.ORDER_MANAGE_URL)
    public Observable<String> OrderManageRequestStr(@QueryMap Map<String, String> params);

    //返回Str类型结果 删除某一个收货地址
    @POST(URLConfig.DELETE_ADDRESS_URL)
    public Observable<String> RemoveAddressRequestStr(@QueryMap Map<String, String> params);

    @POST(URLConfig.DELETE_ADDRESS_URL)
    public Observable<BaseParse<String>> RemoveAddressRequest(@QueryMap Map<String, String> params);

    //返回Str类型结果设置默认收货地址
    @POST(URLConfig.SET_DEFAULT_PAY_ADDRESS_URL)
    public Observable<String> SetDefaultAddressRequestStr(@QueryMap Map<String, String> params);

    @POST(URLConfig.SET_DEFAULT_PAY_ADDRESS_URL)
    public Observable<BaseParse<String>> SetDefaultAddressRequest(@QueryMap Map<String, String> params);

    //返回Str类型  查看购物车
    @POST(URLConfig.FIND_SHOPCART_URL)
    public Observable<String> SelectShopCarRequestStr(@QueryMap Map<String, String> params);

    @POST(URLConfig.FIND_SHOPCART_URL)
    public Observable<ShopCarBean> QueryShopCarRequest(@QueryMap Map<String, String> params);

    //返回Str类型  删除购物车订单
    @POST(URLConfig.DELETE_SHOPCART_URL)
    public Observable<String> DeleteShopCarRequestStr(@QueryMap Map<String, String> params);

    //返回Str类型  编辑购物车订单
    @POST(URLConfig.EDIT_PAYCART_URL)
    public Observable<String> UpdateShopCarRequestStr(@QueryMap Map<String, String> params);


    /**
     * 向手机发送验证码
     *
     * @param params
     * @return
     */
    @POST(URLConfig.PERSONAL_CHANGE_PHONE)
    @FormUrlEncoded
    public Observable<String> PERSONAL_CHANGE_PHONE(@FieldMap Map<String, String> params);

    //返回Str类型  绑定支付宝
    @FormUrlEncoded
    @POST(URLConfig.BIND_ALIPAY_ACCOUNT_URL)
    public Observable<String> AddZFBRequestStr(@FieldMap Map<String, String> params);

    //返回Str类型结果 提现
    @FormUrlEncoded
    @POST(URLConfig.TIXIAN_URL)
    public Observable<String> tixian(@FieldMap Map<String, String> params);


    @POST(URLConfig.PRODUCT_DETAIL_URL)
    public Observable<BaseParse<ProductInfo>> getProductDetail(@QueryMap Map<String, String> params);

    @FormUrlEncoded
    @POST(URLConfig.ADD_PRODUCT_CART_URL)
    public Observable<ParentBean> addShopCar(@FieldMap Map<String, String> params);

    @POST(URLConfig.SETUP_PAYPASSWORD_URL)
    public Observable<ParentBean> setupPayPass(@QueryMap Map<String, String> params);

    @POST(URLConfig.PAY_BANLANCE_URL)
    @FormUrlEncoded
    public Observable<ParentBean> payBalance(@FieldMap Map<String, String> params);

    //提交订单
    @POST(URLConfig.ORDER_POST_URL)
    @FormUrlEncoded
    public Observable<BaseParse<BaseParse.properOrder>> postOrder(@FieldMap Map<String, String> params);

    /*订单详情*/
    @POST(URLConfig.ORDER_INFO_URL)
    public Observable<BaseParse<BaseParse.OrderInfo>> getOrderInfo(@QueryMap Map<String, String> params);

    /*首页*/
    @POST(URLConfig.HOME_URL)
    public Observable<BaseParse<HomeBean>> getHome();
    @POST(URLConfig.HOME_URL)
    public Observable<BaseParse<HomeBean>> getHome(@QueryMap Map<String, String> params);

    /*分类列表根据ID来查询产品列表*/
//    @Headers("apikey:ac7c302dc489a69082cbee6a89e3646c")
    @POST(URLConfig.TYPE_URL)
    public Observable<BaseParseList<ProductInfo>> getFenleiList(@QueryMap Map<String, String> params);

    /*订单取消*/
    @POST(URLConfig.ORDER_CANCEL_URL)
    public Observable<BaseParse<String>> postOrderCancel(@QueryMap Map<String, String> params);


    /*订单生成alipay url*/
    @POST(URLConfig.CREATE_ALI_ORDER)
    @FormUrlEncoded
    public Observable<BaseParse<BaseParse.properOrder>> createAliPay(@FieldMap Map<String, String> params);

    /*订单生成alipay url*/
    @POST(URLConfig.PAY_RETURN_URL)
    @FormUrlEncoded
    public Observable<String> payReturnUrl(@FieldMap Map<String, String> params);

    //获取预处理订单里面的一些信息
    @POST(URLConfig.GO_ACCOUNT_URL)
    @FormUrlEncoded
    public Observable<BaseParse<OrderProperInfoBean>> getGoAccount(@FieldMap Map<String, String> params);

    /*发送验证码*/
    @POST(URLConfig.SEND_CHECK_CODE)
    @FormUrlEncoded
    public Observable<String> sendChecCode(@FieldMap Map<String, String> params);

    /*检测验证码*/
    @POST(URLConfig.CHECK_INPUTCODE)
    @FormUrlEncoded
    public Observable<String> Check_UnputCode(@FieldMap Map<String, String> params);

    //忘记登录密码
    @POST(URLConfig.FORGET_LOGIN_PASSWORD)
    @FormUrlEncoded
    public Observable<String> forgetLoginPassword(@FieldMap Map<String, String> params);

    //查看物流
    @POST(URLConfig.LOGISTICS_INFO_URL)
    @FormUrlEncoded
    public Observable<BaseParse<LogisticsInfoBean>> getLogisticsInfo(@FieldMap Map<String, String> params);

    //订单收货确认
    @POST(URLConfig.CONFIRM_RECEIPT)
    @FormUrlEncoded
    public Observable<String> ConfirmReceipt(@FieldMap Map<String, String> params);

    //查看消息
    @POST(URLConfig.QUERY_MESSAGE)
    @FormUrlEncoded
    public Observable<String> Query_Message_Receipt(@FieldMap Map<String, String> params);

    //消息状态改变
    @POST(URLConfig.CHANGE_MSG_STATUS)
    @FormUrlEncoded
    public Observable<String> CHANGE_MSG_STATUS_Receipt(@FieldMap Map<String, String> params);

    //查看未读消息
    @POST(URLConfig.QUERY_MESSAGE_COUNT)
    @FormUrlEncoded
    public Observable<String> CQUERY_MESSAGE_COUNT_Receipt(@FieldMap Map<String, String> params);

    //删除消息
    @POST(URLConfig.INVALID_MES_STATUS)
    @FormUrlEncoded
    public Observable<String> INVALID_MES_STATUS_Receipt(@FieldMap Map<String, String> params);

    //修改手机号
    @POST(URLConfig.CHECK_PHONE_CODE)
    @FormUrlEncoded
    public Observable<String> Set_Phone_Message_Receipt(@FieldMap Map<String, String> params);

    //修改用户个人信息
    @POST(URLConfig.PERSONAL_CHANGE_INFO)
    @FormUrlEncoded
    public Observable<String> PERSONAL_CHANGE_INFO_Receipt(@FieldMap Map<String, String> params);

    //修改用户个人信息(头像)
    @Multipart
    @POST(URLConfig.PERSONAL_CHANGE_HANDPIC)
    public Observable<String> PERSONAL_CHANGE_INFO_IMG_Receipt(@PartMap Map<String, RequestBody> params);

    // 向邮箱发送验证码
    @POST(URLConfig.PERSONAL_BIND_EMAIL)
    @FormUrlEncoded
    public Observable<String> PERSONAL_BIND_EMAIL_Receipt(@FieldMap Map<String, String> params);

    //检测邮箱验证码并绑定
    @POST(URLConfig.PERSONAL_CHECK_EMAIL)
    @FormUrlEncoded
    public Observable<String> PERSONAL_CHECK_EMAIL_Receipt(@FieldMap Map<String, String> params);

    //查看个人信息
    @POST(URLConfig.GET_PERSONAL_INFO)
    @FormUrlEncoded
    public Observable<String> GET_PERSONAL_INFO_Receipt(@FieldMap Map<String, String> params);

    //邀请好友二维码
    @POST(URLConfig.INVITE_FRIEND_CODE)
    @FormUrlEncoded
    public Observable<String> INVITE_FRIEND_CODE(@FieldMap Map<String, String> params);

    //邀请好友记录
    @POST(URLConfig.INVITE_FRIEND_RECORD)
    @FormUrlEncoded
    public Observable<String> INVITE_FRIEND_RECORD(@FieldMap Map<String, String> params);

    @POST(URLConfig.CONFIRM_RECEIPT)
    @FormUrlEncoded
    public Observable<BaseParse<String>> ConfirmReceiptBean(@FieldMap Map<String, String> params);

    /*
    * 微信支付
    * */
    @POST(URLConfig.CREATE_WECHAT_PAY_URL)
    @FormUrlEncoded
    public Observable<BaseParse<WechatBean>> CreateWechatPay(@FieldMap Map<String, String> params);

    /*获取搜索的关键字列表*/
    @POST(URLConfig.SEARCH_PRODUCT_HINT)
    @FormUrlEncoded
    public Observable<BaseParseList<SearchBean>> getSearchHintList(@FieldMap Map<String, String> params);

    /*查询品牌列表*/
    @POST(URLConfig.QUERY_BRAND)
    @FormUrlEncoded
    public Observable<BaseParseList<BrandListBean>> getBrandList(@FieldMap Map<String, String> params);

    /*查询品牌详情*/
    @POST(URLConfig.QUERY_BRAND_DETAIL)
    @FormUrlEncoded
    public Observable<BaseParseList<ProductInfo>> getBrandDetail(@FieldMap Map<String, String> params);

    /*查询搜索结果*/
    @POST(URLConfig.SEARCH_PRODUCT_DETAIL)
    @FormUrlEncoded
    public Observable<BaseParseList<ProductInfo>> getSearchResultDetail(@FieldMap Map<String, String> params);

    /*收藏*/
    @POST(URLConfig.COLLECT_GOODS)
    @FormUrlEncoded
    public Observable<BaseParse<String>> CollctionGoods(@FieldMap Map<String, String> params);

    /*查询分类*/
    @POST(URLConfig.QUERYALLCATEGORY)
    @FormUrlEncoded
    public Observable<BaseParseList<CategoryBean>> QUERYALLCATEGORY(@FieldMap Map<String, String> params);

    /*发布评论*/
    @POST(URLConfig.POSTCOMMENT)
    @FormUrlEncoded
    public Observable<BaseParse<String>> POSTCOMMENT(@FieldMap Map<String, String> params);

    /*评论列表*/
    @POST(URLConfig.QUERYPRODUCTEVALUATE)
    @FormUrlEncoded
    public Observable<BaseParseList<CommentInfoBean>> GETCOMMENTLIST(@FieldMap Map<String, String> params);

    /*我的收藏*/
    @POST(URLConfig.MY_COLLECTION)
    @FormUrlEncoded
    public Observable<BaseParseList<ProductInfo>> COLLCTIONlIST(@FieldMap Map<String, String> params);

    /*线下体验店列表*/
    @POST(URLConfig.OFFLINELIST)
    @FormUrlEncoded
    public Observable<BaseParseList<OffLineStoreBean>> GETOFFLINELIST(@FieldMap Map<String, String> params);

    @POST(URLConfig.OFFLINESTOREDETAIL)
    @FormUrlEncoded
    public Observable<BaseParse<OffLineStoreBean>> getOfflineStoreInfo(@FieldMap Map<String, String> params);

    /**
     * 获取申请退款的信息
     *
     * @param params
     * @return
     */
    @POST(URLConfig.APPLYINFO)
    @FormUrlEncoded
    public Observable<BaseParse<ApplyInfoBean>> getApplyInfo(@FieldMap Map<String, String> params);

    @POST(URLConfig.SUBMITAPPLY)
    @FormUrlEncoded
    public Observable<BaseParse<String>> SUBMITAPPLY(@FieldMap Map<String, String> params);

    /*退款详情*/
    @POST(URLConfig.APPLYDETAIL)
    @FormUrlEncoded
    public Observable<BaseParse<ApplyResultDetailBean>> APPLYDETAIL(@FieldMap Map<String, String> params);
    @POST(URLConfig.REFUNDLIST)
    @FormUrlEncoded
    public Observable<BaseParseList<ApplyOrderInfoBean>> refundlist(@FieldMap Map<String, String> params);
}
